package org.testis.wirelesssecuritymodule.core;

import org.testis.wirelesssecuritymodule.data.WirelessSecurityModuleDataObject;


/**
 *
 * @author nurhat
 */
public class WirelessSecurityProtocolFactory
{

    public static WirelessSecurityProtocol getWirelessSecurityProtocol(
        WirelessSecurityModuleDataObject dObj)
    {
        WirelessSecurityProtocol protocol = null;
        String protocolName = dObj.getWpaProto().toUpperCase();
        if (protocolName.equals("NONE")) {
            protocol = new WirelessSecurityProtocolNone(
                dObj.getWpaSsid(),
                dObj.getWpaPwd(),
                dObj.getParamInterface());
        }
        else if (protocolName.equals("WEP")) {
            protocol = new WirelessSecurityProtocolWEP(
                dObj.getWpaSsid(),
                dObj.getWpaPwd(),
                dObj.getParamInterface());
        }
        else if (protocolName.equals("WPA")) {
            protocol = new WirelessSecurityProtocolWPA(
                dObj.getWpaSsid(),
                dObj.getWpaPwd(),
                dObj.getParamInterface());
        }
        else if (protocolName.equals("WPA2")) {
            protocol = new WirelessSecurityProtocolWPA2(
                dObj.getWpaSsid(),
                dObj.getWpaPwd(),
                dObj.getParamInterface());
        }
        else if (protocolName.equals("CUSTOM")) {
            protocol = new WirelessSecurityProtocolUserDefined(
                dObj.getWpaSsid(),
                dObj.getWpaPwd(),
                dObj.getParamInterface());
        }
        return protocol;

    }
}
